package com.tbit.uqbike.constant.enums;

import com.tbit.uqbike.manager.exception.BaseException;
import lombok.Getter;

/**
 * 站点等级枚举
 *
 */
@Getter
public enum ParkPointLevelEnum {
    HOT_ONE(1, "热门一级"),
    HOT_TWO(2, "热门二级"),
    NORMAL(3, "普通站点"),
    COLD_TWO(4, "冷门二级"),
    COLD_ONE(5, "冷门一级");
    private final Integer level;
    private final String levelName;
    ParkPointLevelEnum(Integer level, String levelName) {
        this.level = level;
        this.levelName = levelName;
    }
    public static String getByLevel(Integer level) {
        for (ParkPointLevelEnum parkPointLevelEnum : ParkPointLevelEnum.values()) {
            if (parkPointLevelEnum.getLevel().equals(level)) {
                return parkPointLevelEnum.levelName;
            }
        }
        return null;
    }
    public static Integer getByLevelName(String levelName) {
        for (ParkPointLevelEnum parkPointLevelEnum : ParkPointLevelEnum.values()) {
            if (parkPointLevelEnum.getLevelName().equals(levelName)) {
                return parkPointLevelEnum.level;
            }
        }
        throw new BaseException(levelName + ",站点等级不存在");
    }
}
